﻿@using Classified.Service
@model IEnumerable<Classified.Domain.Entities.ClassifiedCategory>
@{
    ViewBag.Title = "ClassifiedCategories";
    var maincategories = Model.Where(m => m.ParentCategoryId == 0 );
    Layout = "~/Views/Shared/_Layout.cshtml";
}
<div class="row">

    <div class="span12">
        <h2>
            Sitemap
        </h2>
        <div class="masonry-holder sitemap">
            @foreach (var item in maincategories)
            {
                <ul class="nav nav-list box" style="float: left">
                    @{
                        var subcate = Model.Where(p => p.ParentCategoryId == item.Id);
                    }
                    <li class="nav-header"><a href="@Url.Action("ClassifiedList", "ClassifiedAds", new { id = item.Id, seName = SeService.GetSeName(item.Name) })">
                                               <b>@item.Name</b></a></li>
                    @if (subcate.Any())
                    {
                        foreach (var i in subcate)
                        {
                            var subsubcate = Model.Where(p => p.ParentCategoryId == i.Id); 
                            <li><a href="@Url.Action("ClassifiedList", "ClassifiedAds", new { id = i.Id, seName = SeService.GetSeName(i.Name) })">@i.Name</a>
                            </li>
                        }
                    }
                </ul>
            }
        </div>
        
        <div class="clear">
        </div>
    </div>
    <div class="span3"></div>
</div>
<script type="text/javascript">
    $(function () {

        $('.masonry-holder').masonry({
            itemSelector: '.box',
            columnWidth: 0,
            isAnimated: true
        });

    });
</script>
